<?php
	if(isset($_GET['id']))
	{
		$id = $_GET['id'];
		$res = mysql_fetch_array(mysql_query(" SELECT * FROM news WHERE id = '{$id}' "));
	}
?>
<div>
    <form method="post" enctype="multipart/form-data" class="frm" style="width:820px; margin:10px 10px;" action="new/update.php">
        <h1> CẬP NHẬT TIN TỨC </h1>
        <p> <span style="margin-right:30px;"> Danh mục </span> <select id="select" name="select" style="width:200px;">  
            <option value=""> ------ Chọn danh mục ------ </option>
            <?php
                $query = mysql_query(" SELECT id,full_name FROM category WHERE full_name != '' ORDER BY full_name ");
                while($row = mysql_fetch_array($query))
				{
					$select = $row['id'] == $res['category_id'] ? "selected = 'selected'" : "";
                    echo " <option value='".$row['id']."' $select> ".$row['full_name']." </option> ";
				}
            ?>
        </select> </p>
        
        <input type="text" id="id" name="id" value="<?php echo $id; ?>" hidden="true" />
        
        <p> <span style="margin-right:50px;"> Tiêu đề </span> <input type="text" name="tieude" id="tieude" style="width:500px;" value="<?php 
			echo $res['topic']; ?>"> </p>
        <p> <span> Tóm tắt </span> <textarea rows="10" cols="20" name="tomtat" id="tomtat"><?php echo $res['content_sum']; ?></textarea> </p>
        <p> <span> Nội dung </span> <textarea rows="10" cols="20" name="noidung" id="noidung"><?php echo $res['content']; ?></textarea> </p>
        
        <p style="marin:20px 0px; text-align:center;"> 
            <input type="submit" value="Cập nhật" class="button"> <input type="button" value="Hủy bỏ" id="cancel" class="button">  
        </p>
    </form>
</div>